package com.chujian.Activities;

import java.text.SimpleDateFormat;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.chujian.Utils.JsonUtil;
import com.chujian.model.Book;
import com.chujian.orderingsystem.R;

public class BookDetailConsumerActivity extends Activity{
	private ImageView mIvStatus;
	private TextView mTvResult;
	private TextView mTvArriveTime;
	private TextView mTvTable;
	private TextView mTvUser;
	private TextView mTvRemark;
	private Book mBook;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.book_detail_consumer);
		initView();
		
		Intent intent=getIntent();
		String jsonString=intent.getStringExtra("book");
		mBook=JsonUtil.BookFromJson(jsonString);
		if(mBook!=null){
			SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
			String dateTime = df.format(new java.util.Date(mBook.getArriveTime()));
			mTvArriveTime.setText(dateTime);
			mTvTable.setText(mBook.getTableName());
			mTvUser.setText(mBook.getUserPhone());
			mTvRemark.setText(mBook.getBookRemark());
			
		}
	}
	private void initView() {
		// TODO Auto-generated method stub
		mIvStatus=(ImageView) findViewById(R.id.iv_book_d_consumer_status);
		mTvResult=(TextView) findViewById(R.id.tv_book_d_consumer_status);
		mTvArriveTime=(TextView) findViewById(R.id.tv_book_d_c_arrive_time);
		mTvRemark=(TextView) findViewById(R.id.tv_book_d_c_remark);
		mTvTable=(TextView) findViewById(R.id.tv_book_d_c_table_name);
		mTvUser=(TextView) findViewById(R.id.tv_book_d_c_user_phone);
		
		
		
	}
	public void IbBack(View v){
		BookDetailConsumerActivity.this.finish();
	}
	public void doClick(View v){
		
	}
}
